package com.yc.psychologicalconsultant.controller;

import com.yc.psychologicalconsultant.pojo.ProQuestionnaire;
import com.yc.psychologicalconsultant.pojo.Result;
import com.yc.psychologicalconsultant.service.QuestionService;
import com.yc.psychologicalconsultant.utils.PageUtils;
import com.yc.psychologicalconsultant.vo.dto.Mood;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author YC
 * @version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/question")
public class QuestionController {
    @Resource
    QuestionService questionService;

    /**
     * 每次回答需要使用此方法
     * count 表示次数
     * mood 表示当前的所有情绪值
     */
    @PostMapping("/get")
    public Result getQuestion(@RequestBody Mood mood) {
        log.info("mood" + mood);
        return questionService.getQuestion(mood.getUsername(), mood.getCount(), mood);
    }


    @PostMapping("/create")
    public Result ReReport(String username) {
        return questionService.reportCreate(username);
    }

    @PostMapping("/SubmitProQuestionnaire")
    public Result SubmitProQuestionnaire(@RequestBody ProQuestionnaire proQuestionnaire) {
        log.info("用户上传预处理问题" + proQuestionnaire);
        questionService.SubmitProQuestionnaire(proQuestionnaire);
        return Result.success();
    }
}
